#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 1e5+10;

ll p[12];
void init(){p[0] = 1;for(int i = 1;i < 10;i++) p[i] = p[i-1] * 42;}
int pos(ll x){return lower_bound(p,p+10,x) - p;}

ll mn[N<<2],lz1[N<<2],lz2[N<<2],lz3[N<<2],a[N];
int n,m;
//lz1 : cover_v , lz2 : cover_del , lz3 : add

void cover(int o,int v,ll del){lz1[o] = v; lz2[o] = mn[o] = del; lz3[o] = 0;}

void add(int o,ll x){
	if(lz1[o]){
		lz2[o] -= x; while(lz2[o] < 0) lz2[o] += p[lz1[o] + 1] - p[lz1[o]],lz1[o]++;
		mn[o] = lz2[o];
	}else mn[o] -= x,lz3[o] += x;
}

void pushdown(int o){
	if(lz1[o]){cover(o<<1,lz1[o],lz2[o]); cover(o<<1|1,lz1[o],lz2[o]); lz1[o] = lz2[o] = 0;}
	if(lz3[o]){add(o<<1,lz3[o]); add(o<<1|1,lz3[o]); lz3[o] = 0;}
}

void modify(int xl,int xr,int v,ll delta,int o = 1,int l = 1,int r = n){
	if(xl == l && xr == r) return cover(o,v,delta);
	int mid = l+r>>1; pushdown(o); if(xr <= mid) modify(xl,xr,v,delta,o<<1,l,mid);
	else if(xl > mid) modify(xl,xr,v,delta,o<<1|1,mid+1,r);
	else modify(xl,mid,v,delta,o<<1,l,mid),modify(mid+1,xr,v,delta,o<<1|1,mid+1,r);
	mn[o] = min(mn[o<<1],mn[o<<1|1]);
}

ll add(int xl,int xr,int x,int o = 1,int l = 1,int r = n){
	if(xl == l && xr == r && (mn[o] > x || lz1[o])) return add(o,x),mn[o];
	int mid = l+r>>1; pushdown(o); if(xr <= mid) add(xl,xr,x,o<<1,l,mid);
	else if(xl > mid) add(xl,xr,x,o<<1|1,mid+1,r);
	else add(xl,mid,x,o<<1,l,mid),add(mid+1,xr,x,o<<1|1,mid+1,r);
	return mn[o] = min(mn[o<<1],mn[o<<1|1]);
}

ll query(int pos,int o = 1,int l = 1,int r = n){
//	cout<<pos<<o<<"..."<<l<<".."<<r<<endl;
	if(l == r) return p[lz1[o]] - lz2[o];
	int mid = l+r>>1; pushdown(o);if(pos <= mid) return query(pos,o<<1,l,mid);else return query(pos,o<<1|1,mid+1,r);
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	n = in,m = in;
	init();
	for(int i = 1,x;i <= n;i++) x = in,modify(i,i,pos(x),p[pos(x)] - x);
	while(m--){
		int op = in;
		if(op == 1){
			int x = in; printf("%lld\n",query(x));
		}else if(op == 2){
			int l = in,r = in,x = in;
			modify(l,r,pos(x),p[pos(x)]-x);
		}else{
			int l = in,r = in,x = in;
			while(!add(l,r,x));
		}
	}
	return 0;
}
